🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / docs / src / commonMain / kotlin / org / meshtastic / feature / docs / ai / KeywordFallbackAssistant.kt
Displaying Raw • Download
feature/docs/src/commonMain/kotlin/org/meshtastic/feature/docs/ai/KeywordFallbackAssistant.kt 65a1f5ce4d0e4b8eafcd0bbfccafd41dc6ee888a (65a1f5ce) Text, 2.33 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.docs.ai
Tff7b72import T7ee787kotlinx.coroutines.flow.MutableStateFlow
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.koin.core.annotation.Single
Tff7b72import T7ee787org.meshtastic.feature.docs.data.KeywordSearchEngine
Tff7b72import T7ee787org.meshtastic.feature.docs.model.AIDocAssistantResult
Tff7b72import T7ee787org.meshtastic.feature.docs.model.ModelReadiness
T8b949e/** Keyword-search-only fallback AI assistant implementation. Used on Desktop, iOS, and Android fdroid flavor. */
Tf0883e@SingleTb4b4b4(Te6edf3binds Tff7b72= Tff7b72[Tff7b72]Tb4b4b4)
Tff7b72class T56d364KeywordFallbackAssistantTb4b4b4(Tff7b72private Tff7b72val Te6edf3searchEngineTb4b4b4: Te6edf3KeywordSearchEngineTb4b4b4) Tb4b4b4: Te6edf3AIDocAssistant Tb4b4b4{
Tff7b72override Tff7b72val Te6edf3modelStatusTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3ModelReadinessTff7b72> Tff7b72= Te6edf3MutableStateFlowTb4b4b4(Te6edf3ModelReadinessTb4b4b4.Te6edf3UnavailableTb4b4b4(Tff7b72nullTb4b4b4)Tb4b4b4)
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffisSupportedTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Boolean Tff7b72= Tff7b72false
Tff7b72override Tff7b72suspend Tff7b72fun Td2a8ffanswerTb4b4b4(Te6edf3questionTb4b4b4: Tffa657StringTb4b4b4, Te6edf3currentPageIdTb4b4b4: Tffa657String?Tb4b4b4)Tb4b4b4: Te6edf3AIDocAssistantResult Tb4b4b4{
Tff7b72val Te6edf3pages Tff7b72= Te6edf3searchEngineTb4b4b4.Te6edf3selectForTokenBudgetTb4b4b4(Te6edf3questionTb4b4b4, Te6edf3maxChars Tff7b72= T79c0ff2T79c0ff0Te6edf3_000Tb4b4b4)
Tff7b72return Tff7b72if Tb4b4b4(Te6edf3pagesTb4b4b4.Te6edf3isNotEmptyTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4{
Te6edf3AIDocAssistantResultTb4b4b4.Te6edf3FallbackTb4b4b4(
Te6edf3message Tff7b72= Ta5d6ff"Ta5d6ffAI assistant is not available on this platform. Here are pages that may help:Ta5d6ff"Tb4b4b4,
Te6edf3suggestedPages Tff7b72= Te6edf3pagesTb4b4b4,
Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3AIDocAssistantResultTb4b4b4.Te6edf3ErrorTb4b4b4(Te6edf3reason Tff7b72= Te6edf3orgTb4b4b4.Te6edf3meshtasticTb4b4b4.Te6edf3featureTb4b4b4.Te6edf3docsTb4b4b4.Te6edf3modelTb4b4b4.Te6edf3DocsAiErrorTb4b4b4.Te6edf3UnsupportedPlatformTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72override Tff7b72fun Td2a8ffanswerStreamTb4b4b4(
Te6edf3questionTb4b4b4: Tffa657StringTb4b4b4,
Te6edf3currentPageIdTb4b4b4: Tffa657String?Tb4b4b4,
Tb4b4b4)Tb4b4b4: Te6edf3kotlinxTb4b4b4.Te6edf3coroutinesTb4b4b4.Te6edf3flowTb4b4b4.Te6edf3FlowTff7b72<Te6edf3AIDocAssistantResultTff7b72> Tff7b72=
Te6edf3kotlinxTb4b4b4.Te6edf3coroutinesTb4b4b4.Te6edf3flowTb4b4b4.Te6edf3flow Tb4b4b4{ Te6edf3emitTb4b4b4(Te6edf3answerTb4b4b4(Te6edf3questionTb4b4b4, Te6edf3currentPageIdTb4b4b4)Tb4b4b4) Tb4b4b4}
Tff7b72override Tff7b72fun Td2a8ffresetSessionTb4b4b4(Tb4b4b4) Tb4b4b4{
T8b949e/* No-op for keyword fallback */
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s